package com.hspedu.final_;

/**
 * @Author Stringzhua
 * @Date 2024/3/5 20:56
 * description:编写一个程序,计算圆形的面积
 * 要求圆周率为3.14 赋值的位置3个
 */
public class FinalExercise01 {
    public static void main(String[] args) {
        Circle circle = new Circle(5.0);
        System.out.println("circle.calArea() = " + circle.calArea());
    }
}

class Circle {
    private double radius;
    private final double PI = 3.14;//直接赋值
//    private final double PI_2;
//    private final double PI_3;
//
//    {
//        PI_2 = 3.14;//普通代码块赋值
//    }
//
//    public Circle(double PI_3) {//构造器
//        this.PI_3 = 3.14;
//    }
//


    public Circle(double radius) {
        this.radius = radius;
    }

    public double calArea() {
        return PI * radius * radius;
    }
}